package com.miyake.dsp.osa.lab.wrapper;

import com.miyake.dsp.filter.FilterImplScilabProxy;
import com.miyake.dsp.filter.FilterSetting;
import com.miyake.dsp.osa.lab.Calculator;
import com.miyake.dsp.osa.lab.LabUiAnnotation;

@LabUiAnnotation(caption="Filter")
public class FilterWrapper extends Calculator{
	public static final String INPUT = "Input";
	public static final String OUTPUT= "Filtered";
	public static final String OUTPUT_MAGNITUDE= "Magnitude";
	public static final String OUTPUT_PHASE= "Phase";
	FilterImplScilabProxy filter;
	
	public FilterWrapper(FilterSetting setting) {
		filter = new FilterImplScilabProxy(setting);
		initInput(INPUT);
		initOutput(OUTPUT);
		initOutput(OUTPUT_MAGNITUDE);
		initOutput(OUTPUT_PHASE);
	}
	@Override
	public synchronized void process() {
		filter.setSource(getInput(INPUT));
		setOutput(OUTPUT, filter.getProcessed());
	}

	@Override
	public Object getSetting() {
		return filter.getSetting();
	}

}
